package com.cll.mapper;

import com.cll.annotation.AutoFill;
import com.cll.entity.DishFlavor;
import com.cll.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 口味Mapper
 */
@Mapper
public interface DishFlavorMapper {

    /**
     * 批量插入口味数据
     * 在springboot中的Mybatis都不想要起别名
     * @param dishFlavors
     */
    @AutoFill(OperationType.INSERT)
    void saveBatches(List<DishFlavor> dishFlavors);

    /**
     * 根据菜品dishId删除口味列表
     * @param id
     */
    @Delete("delete from dish_flavor where dish_id = #{id}")
    void deleteByDishId(Long id);

    /**
     * 根据菜品id查询口味列表
     * @param id
     * @return
     */
    @Select("select * from dish_flavor where dish_id = #{id}")
    List<DishFlavor> getByDishId(Long id);
}
